
SET SERVEROUTPUT ON;

CREATE OR REPLACE PROCEDURE myTest(testvalue number)
AS

mystatus		VARCHAR2(10); 	-- uses an SQL datatype
number_of_courses	NUMBER(3) := 0; -- can provide initial value
MAX_CREDITS		CONSTANT	NUMBER(3) := 150;  -- can declare constants
DONE			BOOLEAN :=  false; -- PL/SQL has BOOLEAN datatype
stuNumber		Student.stuId%type;   /* using %, inherits datatype of stuId column */
stuLastname		VARCHAR2(20);  -- can also specify datatype
stuFirstName		Student.firstName%type; /* inherits datatype of firstName column */
stuCredits		NUMBER(3) NOT NULL := 0;  -- can specify NOT NULL 


begin

	
	mystatus :='Excellent';	
	select stuid into stuNumber from student where lastName = 'Chin';
	select lastName into stuLastName from student where stuid ='S1020';
	select firstName into stuFirstName from student where stuid ='S1020'; 


	DBMS_OUTPUT.PUT_LINE('procedure mytest2 called with parameter of '||testvalue);
	DBMS_OUTPUT.PUT_LINE('Variable mystatus has a value of '||mystatus);
	DBMS_OUTPUT.PUT_LINE('Variable number_of_courses has its initial value of '||number_of_courses);
	DBMS_OUTPUT.PUT_LINE('constant MAX_CREDITS has a value of '||MAX_CREDITS);
	if (not DONE) then DBMS_OUTPUT.PUT_LINE('Not DONE is true');
		END IF;
	DBMS_OUTPUT.PUT_LINE('stuNumber for Chin is '||stuNumber);
	DBMS_OUTPUT.PUT_LINE('stuLastName for student S1020 is '||stuLastName);
	DBMS_OUTPUT.PUT_LINE('stuFirstName for student S1020 is '||stuFirstName);
	DBMS_OUTPUT.PUT_LINE('stuCredits has its initial value of'||stuCredits);


end;

/




	